/************************************************************************************
**  
* @copyright (c) 2013-2100,  Technology Co., LTD. All Right Reserved.
*
*************************************************************************************/
/**
* @file	    duye_library.h
* @version     
* @brief      
* @author
* @date     2014-06-20
* @note 
*
*  1. 2014-06-20 Created this file
* 
*/
#pragma once

#include <dlfcn.h>
#include <duye_sys.h>
#include <duye_type.h>

namespace duye {

/** 
 * shared GLibrary wrapper
 */
class Library {
public:
    Library();
    ~Library();

    /**
     * @brief load shared library
     * @param [in] libPath : library path
     * @param [in] flags : RTLD_LAZY|RTLD_NOW
     * @return lib handle
     * @note 
     */		
    static void* open(const int8* libPath, const int32 flags = RTLD_LAZY);

    /**
     * @brief close shared library
     * @param [in] handle : lib handle
     * @return ture/false
     */
    static bool close(void* handle);

    /**
     * @brief get function address
     * @param [in] handle : lib handle
     * @param [in] enter : function name
     * @return function address
     */
	static void* getSym(void* handle, const int8* enter);
};

}
